home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CP14.ARJ / CP.DOC < prev    next >
Text File  |  1992-03-20  |  3KB  |  88 lines

  1. CP (C Printer) is from Dr. Dobbs Journal, Aug 88 (DDJ8808)
  2.  
  3. Key extract from the article "An Aid to Documenting C"
  4. by Stewart Nutter
  5.  
  6. ....
  7.  
  8. The following list are features that I wanted in my charting program:
  9.  
  10. * It should take as input a list of filenames.
  11.  
  12. * It should output a list of all functions, in the order called,
  13.   starting with main.
  14.  
  15. * The program should count the number of times each function is
  16.   invoked.
  17.  
  18. * The program should maintain the module's filename that contains
  19.   the function's source code.
  20.  
  21. * It should count the number of lines and characters in each module.
  22.  
  23. * It should identify the functions not used in the project.
  24.  
  25. * It should create a function index.
  26.  
  27. ......
  28.  
  29.      To use the program, you must create a file that contains a list of
  30. all your C source filenames.  You do not need to sort the file:  cp sorts
  31. the file itself so it can tell how far along it is during the processing.
  32. For example, the program cp.exe is created from the two source files
  33. cp.c and cpfuncts.c.  Example 2, on page 48, shows the contents of the
  34. list file.  [See CPLST]
  35.  
  36. The command line in this example should have the following information:
  37.   cp mylist outfile
  38.  
  39. mylist is the file that contains the names of the sourcecode files.
  40. outfile is the name of the output file or device.  If the cp program
  41. is called without any arguments on the command line then it will display
  42. the proper usage for the program.  The program defaults to an output file
  43. name of prn if no file name is given on the command line.  To invoke cp
  44. for the xample program, type
  45.  
  46.   cp cplist cplist.prn<enter>
  47.  
  48. The program cp will read the file cplist for the list of filenames and
  49. will output the printout to the file cplist.prn.
  50.  
  51. ....
  52.  
  53. Revisions and improvements:
  54.  
  55. ...
  56.  
  57. Since I finished the first version of cp, I've added a number of
  58. improvements, including these:
  59.  
  60. 1.  Support for Microsoft Windows C programs.
  61.  
  62. 2.  The ability to enter a starting function name, instead of just main
  63. from the command line.  For example, in a windows program, main would
  64. be named WinMain.
  65.  
  66. 3.  Command-line arguments for page width and length.
  67.  
  68. 4.  The saving of the first comment of each module to be printed as a
  69. short module description list.
  70.  
  71. 5.  A command-line switch to print the statistical information only.
  72.  
  73. Feel free to use the program at home or in your business, but please don't
  74. distribute it for profit.
  75.  
  76. [Stewart Nutter is a senior programmer for York International Inc.
  77. He can be reached at 1111 W. Gay St., Red Lion PA  17356.]
  78.  
  79. Extract, C compiles, Borland C tweaks, courtesy of David Kirschbaum,
  80. Toad Hall, kirsch@usasoc.soc.mil.
  81.  
  82. v1.4 Tweaks
  83. - Changed to COMPACT model: runs fine.
  84. - Removed output file parameter processing, PRN default, etc.
  85.   All now goes to STDOUT (and you redirect where you want it).
  86. - Funny bug:  during initial processing, the first string (I suppose
  87.   in the data segment) of the program keeps getting displayed.
  88.